/**
 * 
 */
package org.arpit.masteringextjs.domain;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.arpit.masteringextjs.jsonserializer.CountryToIdSerializer;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * @author arpit.rathore
 *
 */
@Entity
public class City extends BaseEntity{

	private String city;
	
	@ManyToOne
	@JoinColumn
	private Country country;

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the country
	 */
	@JsonProperty("country_id")
	@JsonSerialize(using = CountryToIdSerializer.class, as = Country.class)
	public Country getCountry() {
		return country;
	}

	/**
	 * @param country the country to set
	 */
	public void setCountry(Country country) {
		this.country = country;
	}
	
	@Override
	@JsonProperty("city_id")
	public Long getId() {
		return super.getId();
	}
}
